﻿@using ASoft.Web.Base;
<!DOCTYPE html>

<html lang="en">
<head>
    <title>@ViewBag.Title</title>
    <script src="../../Content/jquery-1.7.1.min.js"></script>
    <link href="../../Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <script src="../../Content/bootstrap/js/bootstrap.min.js"></script>

    <script src="../../Content/myjs.js"></script>
    <style>
        body {
            padding-top: 80px;
            font-size: 12px;
        }
    </style>
</head>
<body>
    <div class="navbar navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container">
                <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
                <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>
                <ul class="nav">
                    <img src="/Content/logo.png" style="width: 36px; height: 36px" />
                </ul>
                <div class="brand">北京蓝洋益海科技有限公司</div>

                <ul class="nav pull-right">
                    <li class="divider-vertical"></li>
                    @{
                        var customs = CurrentContext.Customs.ToList();
                        var currentCustom = CurrentContext.Customs.FirstOrDefault(p => string.Equals(p.Code, CurrentContext.CustomCode, StringComparison.CurrentCultureIgnoreCase));
                        if (currentCustom != null)
                        {
                            customs.Remove(currentCustom);
                        }
                    }

                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">@(currentCustom == null ? "空" : currentCustom.ToString())<b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            @foreach (var item in customs)
                            {
                                <li><a href="#" onclick="$.myjs.changeCustom('@item.Code')">@item.ToString()</a></li>    
                            }
                        </ul>
                    </li>

                    @if (ASoft.Web.Base.CurrentContext.IsLogin)
                    {
                        <li class="divider-vertical"></li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">@CurrentContext.AUser.ToString()<b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li>@Html.ActionLink("修改密码", "changepassword", "auser")</li>
                                <li>@Html.ActionLink("注销", "LogOff", "LogIn")</li>
                            </ul>
                        </li>
                    }
                    @if (ASoft.Web.Base.CurrentContext.IsAdmin)
                    {
                        var allItems = new string[,] { 
                        {"roomdata","实时数据"}, 
                        {"custom","客户管理"}, 
                        {"auser","用户管理"}, 
                        {"customauser","用户客户关系管理"} };

                        var controllerName = Request.RequestContext.RouteData.Values["controller"].ToString().ToLower();
                  
                        <li class="divider-vertical"></li>
                        <li class="dropdown">
                            @for (int i = 0; i < allItems.GetLength(0); i++)
                            {
                                if (allItems[i, 0] == controllerName)
                                { 
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">@allItems[i, 1]<b class="caret"></b></a>
                                }
                            }
                            <ul class="dropdown-menu">
                                @for (int i = 0; i < allItems.GetLength(0); i++)
                                {
                                    if (allItems[i, 0] != controllerName)
                                    {
                                    <li>@Html.ActionLink(allItems[i, 1], "index1", allItems[i, 0])</li>
                                    }
                                }
                            </ul>
                        </li>  
                    }
                    <li style="width: 50px"></li>
                </ul>
            </div>
            <!--/.nav-collapse -->
        </div>
    </div>

    <div class="container">
        @RenderBody()
    </div>
    <!-- /container -->
</body>


</html>
